package cn.wellwan.controller;

import cn.wellwan.commons.Result;
import cn.wellwan.service.WechatService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 小程序相关接口
 */
@RestController
@RequestMapping(value = "applet")
public class AppletController {

    @Autowired
    private WechatService wechatService;
    @RequestMapping(value="decode")
    public Result decode(String code) {
        return new Result().data( wechatService.decode(code));
    }


    @RequestMapping(value="decodeUserInfo")
    public Result decodeUserInfo(String encryptedData,String sessionkey,String iv) {
        return new Result().data( wechatService.decodeUserInfo(encryptedData,sessionkey,iv));
    }

}
